function randomString(len) {
    let text = "";
    const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    for (let i = 0; i < len; i++) {
        text += possible.charAt(Math.floor(Math.random() * possible.length));
    }

    return text;
}

function getBaseUrl() {
    // Service Worker doesn't have location object
    // This function is mainly used in content scripts
    return '';
}

function getPageLocationOrigin() {
    // 返回完整域名
    return location.origin;
}
